package com.ruoyi.controller;

import com.ruoyi.dto.FileVO;
import com.ruoyi.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@CrossOrigin(origins = "*")
@RestController
    public class UploadController {
    @Autowired
    private FileService fileService;
        @PostMapping("/upload")
        public FileVO upload(MultipartFile file) throws IOException {
            FileVO fileVO = fileService.upload(file);
            return fileVO;
        }
    }

